sub infix:<cmp>

Documentation for sub infix:<cmp> assembled from the following types:

class Range

From Range

(Range) sub infix:<cmp>

multi sub infix:<cmp>(Range:D \a, Range:D \b --> Order:D)
multi sub infix:<cmp>(Num(Real) \a, Range:D \b --> Order:D)
multi sub infix:<cmp>(Range:D \a, Num(Real) \b --> Order:D)
multi sub infix:<cmp>(Positional \a, Range:D \b --> Order:D)
multi sub infix:<cmp>(Range:D \a, Positional \b --> Order:D)

Compares two Range objects. If you use a Real, it will be compared to the Range b..b. If you use a Positional.

say (1..2) cmp (1..2); # OUTPUT: «Same␤»
say (1..2) cmp (1..3); # OUTPUT: «Less␤»
say (1..4) cmp (1..3); # OUTPUT: «More␤»
say (1..2) cmp 3;      # OUTPUT: «Less␤»
say (1..2) cmp [1,2];  # OUTPUT: «Same␤»

class DateTime

From DateTime

(DateTime) sub infix:<cmp>

multi sub infix:<cmp>(DateTime:D \a, DateTime:D \b --> Order:D)

Compares the equivalent instant, returns the Order.